package com.lanou.tipsy.broadcastReceiver;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.util.Log;

import com.lanou.tipsy.data.MyEventBus;

import de.greenrobot.event.EventBus;

/**
 * Created by penglei on 15/11/12.
 */
public class NotificationRecevier extends BroadcastReceiver {
    public static final String NOTIFICATION_ITEM_BUTTON_LAST = "com.lly.notification.ServiceReceiver.last";// ----通知栏上一首按钮
    public static final String NOTIFICATION_ITEM_BUTTON_PLAY = "com.lly.notification.ServiceReceiver.play";// ----通知栏播放按钮
    public static final String NOTIFICATION_ITEM_BUTTON_NEXT = "com.lly.notification.ServiceReceiver.next";// ----通知栏下一首按钮
    public static final String NOTIFICATION_ITEM_BUTTON_DELETE = "com.lly.notification.ServiceReceiver.delete";// ----通知栏清楚按钮
    public static int status = 1; // 1 代表播放  2 代表暂停

    @Override
    public void onReceive(Context context, Intent intent) {

        String action = intent.getAction();
        if (action.equals(NOTIFICATION_ITEM_BUTTON_LAST)) {// ----通知栏播放按钮响应事件
        } else if (action.equals(NOTIFICATION_ITEM_BUTTON_PLAY)) {// ----通知栏播放按钮响应事件
            EventBus.getDefault().post(new MyEventBus.Play(1));
            Log.i("wangshuai", "播放");
        } else if (action.equals(NOTIFICATION_ITEM_BUTTON_NEXT)) {// ----通知栏下一首按钮响应事件
            EventBus.getDefault().post(new MyEventBus.Play(2));

            Log.i("wangshuai", "下一首");
        } else if (action.equals(NOTIFICATION_ITEM_BUTTON_DELETE)) {
            EventBus.getDefault().post(new MyEventBus.Play(3));

            Log.i("wangshuai", "删除");
        }

    }
}
